package com.example.demo.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import java.net.URI;



/**
 * Author: wuhaoduan
 * Date: 2021/4/27 8:42
 */
public class HttpSend {

    public static Resource GetVirusData(String url){
        RequestEntity<Void> requestEntity = RequestEntity
                .get(URI.create(url))
                .headers(httpsHeaders -> httpsHeaders.add("User-Agent","Mozilla/5.0"))
                .build();
        ResponseEntity<Resource> exchange = new RestTemplate().exchange(requestEntity, Resource.class);
        return exchange.getBody();
    }


}
